package com.liuzy.resource;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.liuzy.entity.UserEntity;
import com.liuzy.mapper.UserEntityMapper;
import com.liuzy.mybaties.Mybaties;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class Resource {
	private UserEntityMapper userEntityMapper = Mybaties.getMapper(UserEntityMapper.class);

	@GET
	public Object get() {
		return userEntityMapper.selectAll();
	}
	
	@POST
	public Object post() {
		UserEntity record = new UserEntity();
		record.setUsername("test");
		record.setPassword("test");
		userEntityMapper.insert(record);
		return userEntityMapper.selectAll();
	}
}
